import Vue from 'vue'

export const SET_MY_SECRET_INFO = 'SET_MY_SECRET_INFO' //我的神秘资料

export const UPDATE_MY_SECRET_SIGNAL = 'UPDATE_MY_SECRET_SIGNAL'
export const UPDATE_LIKE_TYPE = 'UPDATE_LIKE_TYPE' //更新签名
export const UPDATE_USUALLY_AREA = 'UPDATE_USUALLY_AREA' //更新签名



export default {
  state: {
    avatarList: [],
    likeType: '',
    likeTypePrice: 0,
    secretSignal: '',
    secretSignalPrice: 0,
    usuallyArea: '',
    usuallyAreaPrice: 0,
    voiceUrl: '',
    voiceUrlPrice: 0
  },
  getters: {

  },
  mutations: {

    [SET_MY_SECRET_INFO](state, mySecretInfo) {
      Object.assign(state, mySecretInfo) //把user的属性复制给state
    },

    [UPDATE_MY_SECRET_SIGNAL](state, payload) {
      state.secretSignal = payload.signal;
      state.secretSignalPrice = payload.price;
    },

    [UPDATE_LIKE_TYPE](state, payload) {
      state.likeType = payload.likeType;
      state.likeTypePrice = payload.price;
    },

    [UPDATE_USUALLY_AREA](state, payload) {
      state.usuallyArea = payload.usuallyArea;
      state.usuallyAreaPrice = payload.price;
    }

  },
  actions: {
    [SET_MY_SECRET_INFO]({
      commit
    }, mySecretInfo) {
      // console.log('SET_MY_SECRET_INFO action');
      commit(SET_MY_SECRET_INFO, mySecretInfo);
    },

    [UPDATE_MY_SECRET_SIGNAL]({
      commit
    }, payload) {
      // console.log('signal = ' + payload.signal);
      // console.log('price = ' + payload.price);
      commit(UPDATE_MY_SECRET_SIGNAL, payload)
    },

    [UPDATE_LIKE_TYPE]({
      commit
    }, payload) {
      commit(UPDATE_LIKE_TYPE, payload)
    },

    [UPDATE_USUALLY_AREA]({
      commit
    }, payload) {
      commit(UPDATE_USUALLY_AREA, payload)
    }
  }
}
